class Solution {
    ArrayList<Integer> list=new ArrayList();
    public List<Integer> postorderTraversal(TreeNode root) {
        if (root==null){

        }else{
            if(root.left!=null){
                postorderTraversal(root.left);
            }
            if(root.right!=null){
                postorderTraversal(root.right);
            }
            list.add(root.val);
        }
          return list;
    }

}